﻿<cfsilent>
	<cfscript>
	
		sql = "	SELECT
					c.campus_id,
					c.campus_name,
					c.campus_address,
					c.campus_zipcode
				FROM
					t_campus c
				ORDER BY
					c.campus_id ASC";

		queryObj = new Query(datasource = application.dnsSlave);
		rs_campus = queryObj.execute( sql = sql ).getResult();

		event.setArg("pageTitle", "教学运行基础数据 - 教学场地设置");

		targetArgs = structNew();

		currentTab = event.getArg("TabID", "labBaseInfo");

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
	
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 link"></i>教学场地资源设置
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="administration">
			
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labBaseInfo">class="active"</cfif> id="labBaseInfo" tabTarget="BaseInfo">校区分布情况</span>
						<span <cfif currentTab eq "labSetupFrom">class="active"</cfif> id="labSubject" tabTarget="SetupFrom">设置新校区</span>
						<span <cfif currentTab eq "labBuilding">class="active"</cfif> id="labBuilding" tabTarget="Building">设置新教学楼</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="BaseInfo" class="tabContent">
					
					<cfif rs_campus.recordCount>
							
							<div class="noticeBlock">
								<h3>教学园区设定</h3>
								<p><span class="img icon16x16 message"></span>这里列出的是当前拥有的教学园区. 如果您需要设置新的校区信息, 请通过 "设置新校区" 标签设置基础学校园区信息.</p>
								<hr/>
							</div>
							
                            <cfloop query="rs_campus">
								<div class="clearfix">
									<div class="UICardTable">
										<cfset structInsert(targetArgs, "CID", rs_campus.campus_id, true) />
										<dl>
											<dt>
												<a href="<cfoutput>#buildURL('campusSetting', targetArgs)#</cfoutput>">
													<em class="campus"><!--imgholder--></em>
													<dd>
														<h3><cfoutput>#rs_campus.campus_name#</cfoutput></h3>
														<div><cfoutput>#rs_campus.campus_address#<cfif len(rs_campus.campus_zipcode)>,</cfif>#rs_campus.campus_zipcode#</cfoutput></div>
													</dd>
												</a>
											</dt>
										</dl>
									</div>
								</div>

								<hr/>

                                <cfset sql = "	SELECT
													b.b_id,
													b.b_name,
													b.b_floors
												FROM
													t_building b
												WHERE
													b.campus_id = :campusId 
												ORDER BY
													b.b_id ASC"/>
								
                                <cfset queryObj = new Query(datasource = application.dnsSlave) />
                                <cfset queryObj.addParam(name = "campusId", value = rs_campus.campus_id, cfsqltype = "cf_sql_char")/>
                                <cfset rs_build = queryObj.execute(sql = sql).getResult() />
                                
								<cfif rs_build.recordCount>
									<div class="clearfix">
										<div class="UICardTable" style="margin-left:25px;">
                                            <cfloop query="rs_build">
												<cfset structInsert(targetArgs, "BID", rs_build.b_id, true) />
												
												<dl>
													<dt>
														<a href="<cfoutput>#buildURL('buildingSetting', targetArgs)#</cfoutput>">
															<em class="building"><!--imgholder--></em>
															<dd>
																<h3><cfoutput>#rs_build.b_name#</cfoutput></h3>
																<div><cfoutput>#dictAdvice.getBuildingFloorSummary(rs_build.b_floors)#</cfoutput></div>
															</dd>
														</a>
													</dt>
												</dl>
												
											</cfloop>
										</div>
									</div>
								</cfif>
								
							</cfloop>
						
						<cfelse>
							<div class="systemNotice">
								<h3><span class="img icon16x16 info"></span>没有设置任何校区信息</h3>
								<p>当前您还没有设置学校园区信息, 请通过 "设置新校区" 标签设置基础学校园区信息.</p>
							</div>
					</cfif>
					
				</div>
				
				<div id="SetupFrom" class="tabContent">
				
					<form id="formCreate" onSubmit="javascript:return processVerfiyForm('formCreate');" class="formWrapper" method="post" action="<cfoutput>#buildURL('campusCreateDo')#</cfoutput>">
						
						<div class="label">
							<span class="req">*</span><b>校区名称</b>
							<input name="CampusName" id="CampusName" type="text" class="typeTextShort" verification="required" maxlength="15" value="<cfoutput>#event.getArg('CampusName')#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>街道地址</b>
							<input name="Address" id="Address" type="text" class="typeText" maxlength="30" value="<cfoutput>#event.getArg('Address')#</cfoutput>" />
						</div>
						<div class="label">
							<b>邮编</b>
							<input name="ZipCode" id="ZipCode" type="text" class="typeCode" maxlength="6" value="<cfoutput>#event.getArg('ZipCode')#</cfoutput>" />
						</div>
						
						<!---
						<div class="label">
							<b><!--.--></b>
							<input name="showWizard" type="checkbox" checked="checked" class="typeCheckbox" value="1" />同时帮助我设置该校区的教学楼及教室资源
						</div>
						--->
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="提交" />
							<input class="button" type="reset" value="重设表格" />
						</div>
						
					</form>
				
				</div>

				<div id="Building" class="tabContent">
					
					<cfif rs_campus.recordCount>
							
							<form id="formBuilding" onSubmit="javascript:return processVerfiyForm('formBuilding');" class="formWrapper" method="post" action="<cfoutput>#buildURL('buildingCreateDo')#</cfoutput>">

								<div class="label">
									<span class="req">*</span><b>教学楼</b>
									<input name="BuildingName" id="BuildingName" type="text" class="typeTextShort" verification="required" maxlength="30" value="<cfoutput>#event.getArg('BuildingName')#</cfoutput>" />
								</div>
						
								<div class="label">
									<span class="req">*</span><b>楼层分布</b>
									地上<input name="FloorsUp" id="FloorsUp" type="text" class="typeTinyInt" verification="required" maxlength="2" value="" />层,
									地下<input name="FloorsDown" id="FloorsDown" type="text" class="typeTinyInt" verification="required" maxlength="2" value="0" />层
								</div>
						
								<hr/>
						
								<div class="label">
									<b>所在校区</b>
									<select name="CampusID" id="CampusID">
                                        <cfloop query="rs_campus">
											<option value="<cfoutput>#rs_campus.campus_id#</cfoutput>"><cfoutput>#rs_campus.campus_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
						
								<hr/>
						
								<div class="lable">
									<input class="button" type="submit" value="提交" />
									<input class="button" type="reset" value="重设表格" />
								</div>
						
							</form>
							
						<cfelse>
							
							<div class="systemNotice">
								<h3><span class="img icon16x16 info"></span>没有设置校区信息</h3>
								<p>当前您还没有设置校区信息, 请先完成校区设置以后再创建校区内教学楼.</p>
							</div>
							
					</cfif>
					
					
					
				</div>
			
			</div>
		</li>
	</ul>
</div>